//
//  FtOderDetailViewController.m
//  Feast
//
//  Created by 胡光健 on 2017/8/26.
//  Copyright © 2017年 mac. All rights reserved.
//

#import "FtOderDetailViewController.h"

@interface FtOderDetailViewController ()<MAMapViewDelegate>
@property(nonatomic,strong)MAMapView * mapView;
@property (nonatomic, strong) MACircle *circle;
@end

@implementation FtOderDetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self configBannerMap];
}

-(void)configBannerMap {
    self.mapView = [[MAMapView alloc]init];
    self.mapView.mapType = MAMapTypeStandard;
    self.mapView.frame = CGRectMake(0, 0, mScreenWidth, 300);
//    self.mapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    self.mapView.delegate = self;
    self.mapView.customizeUserLocationAccuracyCircleRepresentation = YES;
    self.mapView.userLocationAccuracyCircle.radius = 0;
    self.mapView.showsUserLocation = NO;
    self.mapView.userTrackingMode = MAUserTrackingModeFollow;
    NSString * lat = [mUserDefaults objectForKey:@"lat"];
    NSString * lng = [mUserDefaults objectForKey:@"lng"];
    self.mapView.centerCoordinate = CLLocationCoordinate2DMake([lat doubleValue], [lng doubleValue]);
     [self.mapView setZoomLevel:17.5 animated:YES];
    
    [self.view addSubview:self.mapView];
}

-(MAAnnotationView *)mapView:(MAMapView *)mapView viewForAnnotation:(id<MAAnnotation>)annotation {
    if ([annotation isKindOfClass:[MAPointAnnotation class]]) {
        static NSString *reuseIndetifier = @"annotationReuseIndetifier";
        MAAnnotationView *annotationView = (MAAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:reuseIndetifier];
        if (annotationView == nil) {
            annotationView = [[MAAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:reuseIndetifier];
        }
        annotationView.draggable=YES;
        annotationView.canShowCallout=YES;
        annotationView.imageView.hidden = YES;
        return annotationView;
    }
    return nil;
}

-(MAOverlayRenderer *)mapView:(MAMapView *)mapView rendererForOverlay:(id<MAOverlay>)overlay {
    return nil;
}
@end
